//
// Created by 123 on 2025/1/3.
//
#include "iostream"
#include "fstream"
#include "string"

using namespace std;

void test(){
    ifstream ifs;
    ifs.open("test.txt",ios::in);
    if(!ifs.is_open()){
        cout << "open file fail" <<endl;
        return;
    }
    //读方式1
//    char buf1[1024] = {0};
//    while (ifs >> buf1){
//        cout << buf1 << endl;
//    }

    //读方式2
//    char buf2[1024] = {0};
//    while (ifs.getline(buf2, sizeof(buf2))){
//        cout << buf2 << endl;
//    }
    //读方式3
//    string buf3;
//    while (getline(ifs,buf3)){
//        cout << buf3 <<endl;
//    }
    //读方式4
    char c;
    while((c=ifs.get()) != EOF){
        cout << c;
    }

    ifs.close();


}

int main094(){
    test();

    return 0;
}